package com.gof.example.singleton.lazy;

/**
 * Created with IntelliJ IDEA.
 * Created by zhiyuan on 2018/5/1 21:08.
 * haiming.fei@tongdun.cn
 */
public class LoadBalancer {

    private volatile static LoadBalancer balancer = null;
    private static Object obj = new Object();

    private LoadBalancer() {
        //no instance
    }

    public static LoadBalancer getInstance() {
        if (balancer == null) {
            synchronized (obj) {
                if (balancer == null) {
                    balancer = new LoadBalancer();
                }
            }
        }

        return balancer;
    }
}
